#查找项目通用的一些库文件
#
#
#---------------------------------------------------------------
include(${PROJECT_SOURCE_DIR}/cmake_modules/UtilMacro.cmake)

set(ZeroMQ_ROOT_DIR)
set(Libevent2NeedComponents)

if(WIN32)
	#windows下定义名为ZMQ_ROOT的环境变量保存ZQM安装路径
	set(ZeroMQ_ROOT_DIR	$ENV{ZMQ_ROOT})	
	
	#windows下只链接到event.lib
	set(Libevent2NeedComponents)
else()
	#linux下需要libevent-pthreads,libevent-core,libevent-extra
	set(Libevent2NeedComponents	 COMPONENTS pthreads extra core)
endif()

#添加ZMQ的find_pack模块路径
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ZeroMQ_ROOT_DIR}/CMake)

#查找libevent2库
find_package(LIBEVENT2 ${Libevent2NeedComponents})
if(NOT LIBEVENT2_FOUND)
	message(FATAL_ERROR  "can not find LIBEVENT2")
endif()

#查找ZeroMQ库
find_package(ZeroMQ)
if(NOT ZeroMQ_FOUND)
message(FATAL_ERROR	"can not find ZeroMQ" )
endif()

#查找Boost库
set(Boost_USE_MULTITHREADED ON) #使用多线程
set(Boost_USE_STATIC_LIBS   ON) #使用静态库
find_package(Boost  COMPONENTS filesystem  thread program_options REQUIRED) 	
	
DumpVar(Boost_INCLUDE_DIR)	
DumpVar(Boost_LIBRARIES)
